﻿using System;
using System.Collections.Generic;
using System.Text;

namespace X86Instructions
{
    public class X86Dism
    {
        public static X86InstructionInfo[] SingleByteInstructionTable = null; //
        public static X86InstructionInfo[] DoubleByteInstructionTable = null; //

        public static void Initialize()
        {
            if (SingleByteInstructionTable != null)
                return;

            //initliaze tables
            SingleByteInstructionTable = new X86InstructionInfo[0xff];
            DoubleByteInstructionTable = new X86InstructionInfo[0xff];

        }

        public const Byte TwoByteInstructionPrefix = 0x0f;

        public const X86FlagBit ArithInsFlagAffact = X86FlagBit.OF | X86FlagBit.SF | X86FlagBit.ZF | X86FlagBit.AF | X86FlagBit.PF | X86FlagBit.CF;

        private static void InitSingleByteInsTable()
        {
            SingleByteInstructionTable[0x38] = new X86InstructionInfo(0x38, X86InstMnemonic.CMP, GeneralInstructionSubGroup.Arith, ArithInsFlagAffact, ArithInsFlagAffact, "Compare Two Operands");
            SingleByteInstructionTable[0x39] = new X86InstructionInfo(0x39, X86InstMnemonic.CMP, GeneralInstructionSubGroup.Arith, ArithInsFlagAffact, ArithInsFlagAffact, "Compare Two Operands");
            SingleByteInstructionTable[0x3A] = new X86InstructionInfo(0x3a, X86InstMnemonic.CMP, GeneralInstructionSubGroup.Arith, ArithInsFlagAffact, ArithInsFlagAffact, "Compare Two Operands");
            SingleByteInstructionTable[0x3c] = new X86InstructionInfo(0x3c, X86InstMnemonic.CMP, GeneralInstructionSubGroup.Arith, ArithInsFlagAffact, ArithInsFlagAffact, "Compare Two Operands");
            SingleByteInstructionTable[0x3d] = new X86InstructionInfo(0x3d, X86InstMnemonic.CMP, GeneralInstructionSubGroup.Arith, ArithInsFlagAffact, ArithInsFlagAffact, "Compare Two Operands");

            SingleByteInstructionTable[0x80] = new X86InstructionInfo(0x80, X86InstMnemonic.CMP, GeneralInstructionSubGroup.Arith, ArithInsFlagAffact, ArithInsFlagAffact, "Compare Two Operands");
            SingleByteInstructionTable[0x81] = new X86InstructionInfo(0x81, X86InstMnemonic.CMP, GeneralInstructionSubGroup.Arith, ArithInsFlagAffact, ArithInsFlagAffact, "Compare Two Operands");
            SingleByteInstructionTable[0x82] = new X86InstructionInfo(0x82, X86InstMnemonic.CMP, GeneralInstructionSubGroup.Arith, ArithInsFlagAffact, ArithInsFlagAffact, "Compare Two Operands");
            SingleByteInstructionTable[0x83] = new X86InstructionInfo(0x83, X86InstMnemonic.CMP, GeneralInstructionSubGroup.Arith, ArithInsFlagAffact, ArithInsFlagAffact, "Compare Two Operands");
        }

    }
}
